﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Forms;
using Microsoft.Win32;
using OpenFileDialog = System.Windows.Forms.OpenFileDialog;

namespace SuntabuAssistant.AssistAchieve.Action
{
    public class Startup
    {
        private const string regPath = @"Software\Microsoft\Windows\CurrentVersion\Run";


        public static void SetKey()
        {
            var appPath = Application.ExecutablePath;
            RegistryKey rk = Registry.LocalMachine;
            RegistryKey key = rk.CreateSubKey(regPath);
            key.SetValue("XX", appPath);
            rk.Close();
        }

        private void SetAutoStartup()
        {
            Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
                              , System.Windows.Forms.Application.ProductName,
                              System.Windows.Forms.Application.StartupPath +"\\"+
                              System.Windows.Forms.Application.ProductName);
        }
    }
}
